﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using StorePrgram.Data;
using StorePrgram.Logic;

namespace StorePrgram.View
{
    public partial class FormSale : Form
    {
        private HashSet<Product> productsInCurrentTransaction = new HashSet<Product>();

        public FormSale(HashSet<Product> products)
        {
            this.productsInCurrentTransaction = products;
            InitializeComponent();
        }

        private void buttonAcceptSale_Click(object sender, EventArgs e)
        {
            saveFileDialogInvoice.DefaultExt = "*.rtf";
            saveFileDialogInvoice.Filter = "RTF Files|*.rtf";

            if (saveFileDialogInvoice.ShowDialog() == System.Windows.Forms.DialogResult.OK
                && (saveFileDialogInvoice.FileName.Length > 0))
            {
                try
                {
                    // Save the contents of the RichTextBox into the file.
                    richTextBoxProductsInformation.SaveFile(saveFileDialogInvoice.FileName);
                }
                catch (Exception)
                {
                    MessageBox.Show("Грешка при запис на файл!",
                    "Грешка", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
    }
}
